package org.devocean.groupbuying.domain;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

@SuppressWarnings("serial")
@Entity
public class Menu implements Serializable {

	@Id
	@GeneratedValue
	private Integer menuID;

	private String layout;

	private String title;

	private String view;

	private String permalink;

	private Integer disabled;

	private String metaTitle;

	private String lang;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "menuLocalizationID", referencedColumnName = "menuLocalizationID", nullable = false)
	private MenuLocalization menuLocalization;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "parentID", referencedColumnName = "menuID", nullable = true)
	private Menu menu;

	@OneToMany(cascade = CascadeType.ALL, mappedBy = "menu")
	private Set<Menu> menus = new HashSet<Menu>();

	public Menu getMenu() {
		return menu;
	}

	public void setMenu(Menu menu) {
		this.menu = menu;
	}

	public Set<Menu> getMenus() {
		return menus;
	}

	public void setMenus(Set<Menu> menus) {
		this.menus = menus;
	}

	public MenuLocalization getMenuLocalization() {
		return menuLocalization;
	}

	public void setMenuLocalization(MenuLocalization menuLocalization) {
		this.menuLocalization = menuLocalization;
	}

	public Integer getMenuID() {
		return menuID;
	}

	public void setMenuID(Integer menuID) {
		this.menuID = menuID;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getLang() {
		return lang;
	}

	public void setLang(String lang) {
		this.lang = lang;
	}

	public String getLayout() {
		return layout;
	}

	public void setLayout(String layout) {
		this.layout = layout;
	}

	public String getView() {
		return view;
	}

	public void setView(String view) {
		this.view = view;
	}

	public String getPermalink() {
		return permalink;
	}

	public void setPermalink(String permalink) {
		this.permalink = permalink;
	}

	public Integer getDisabled() {
		return disabled;
	}

	public void setDisabled(Integer disabled) {
		this.disabled = (disabled == null) ? 0 : disabled;
	}

	public String getMetaTitle() {
		return metaTitle;
	}

	public void setMetaTitle(String metaTitle) {
		this.metaTitle = metaTitle;
	}

	@Override
	public String toString() {
		return "Menu [menuID=" + menuID + ", layout=" + layout + ", title="
				+ title + ", view=" + view + ", permalink=" + permalink
				+ ", disabled=" + disabled + ", metaTitle=" + metaTitle
				+ ", lang=" + lang + "]";
	}
	
	

}
